package com.ychs.dpmms.controller;

import com.ychs.dpmms.entity.ResultMessage;
import com.ychs.dpmms.entity.Role;
import com.ychs.dpmms.entity.User;
import com.ychs.dpmms.service.IBaseService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * copyright(c)2021 YYB.ALL rights Reserved
 * <p>
 * 描述:
 *
 * @author 原玉波
 * @version 1.0
 * @date 2021/9/3
 */
@CrossOrigin
@RestController
@RequestMapping("/role")
public class RoleController {

    protected Logger logger = LoggerFactory.getLogger(this.getClass());

    @Resource(name="roleService")
    private IBaseService<Role> service;

    @GetMapping("/search")
    public ResultMessage search() {
        List<Role> roleList = service.search(null);
        int count = service.searchTotalNumber(null);
        logger.debug("roleList=" + roleList.toString());
        ResultMessage resultMessage = new ResultMessage(true, roleList, "" + count);
        return resultMessage;
    }
}
